<#
 #   It is recommended to test the script on a local machine for its purpose and effects. 
 #   ManageEngine Endpoint Central will not be responsible for any 
 #   damage/loss to the data/setup based on the behavior of the script.

 #   Description: Script is designed to check the state of the File History
 #   Configuration Type - COMPUTER
 #   Refer: https://www.tenforums.com/tutorials/64728-enable-disable-file-history-windows-10-a.html
 #>

 # Define the registry path
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\FileHistory"

# Try to get the Disabled DWORD value
try {
    $status = Get-ItemProperty -Path $registryPath -Name "Disabled" -ErrorAction Stop

    if ($status.Disabled -eq 1) {
        Write-Host "File History is disabled."
    } else {
        Write-Host "File History is enabled."
    }
} catch {
    Write-Host "File History is not configured (likely enabled)."
}